/**
 * Created by Administrator on 2017/5/25.
 */
"use strict";
//引入模块
const mongoose = require('mongoose');
const db = require('./db');

// Schema 结构
var SystemmenuSchema = new mongoose.Schema({
    smid      :{type:Number,index: true},//id
    type     :{type:String,index: true},//状态
    title     :{type:String,index: true},//名字
    path    :{type : String},//路由
    iconClass    :{type : String},//图标class
    createTime    :{type : Number,default:new Date().getTime()}//创建时间
});

SystemmenuSchema.statics.findFn = function(obj,obj1, callback) {
    return this.model('Systemmenu').find(obj, callback).sort(obj1);
};
SystemmenuSchema.statics.findFnLimit = function(obj,obj1,num1,callback) {
    return this.model('Systemmenu').find(obj).sort(obj1).limit(num1).exec(callback);
};
SystemmenuSchema.statics.findSortOne = function(obj,obj1,callback) {
    return this.model('Systemmenu').findOne(obj).sort(obj1).exec(callback);
};
SystemmenuSchema.statics.findConut = function(obj,callback) {
    return this.model('Systemmenu').find(obj).count().exec(callback);
};
SystemmenuSchema.statics.removeFn = function(obj,callback) {
    return this.model('Systemmenu').remove(obj,callback);
};
SystemmenuSchema.statics.updateFn = function(obj,obj1,callback) {
    return this.model('Systemmenu').update(obj,obj1).exec(callback);
};

var SystemmenuModel = db.model('Systemmenu', SystemmenuSchema);

module.exports=SystemmenuModel;